home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF4 Files / fxWindows.DEF < prev   
Encoding:
Modula Definition  |  1990-06-14  |  4.6 KB  |  114 lines  |  [TEXT/PMED]

  1. (*************************************)
  2. (**) DEFINITION MODULE fxWindows;(**)
  3. (*************************************)
  4. (* Franz Kronseder / ETHZ / 04.08.85 *)
  5.  
  6. (* This module intends to provide a window administration object (data type) *)
  7. (* that applies standard methods for event parsing, window dragging,sizing, *)
  8. (* activation/deactivation, updating, and dispatches to user supplied *)
  9. (*  "EventHandling methods" *)
  10.  
  11. IMPORT WindowMgr,QuickDraw;
  12. FROM SYSTEM IMPORT ADDRESS;
  13. FROM MacBase IMPORT StrPtr,LongInt;
  14. FROM QuickDraw IMPORT Rect;
  15. FROM EventMgr IMPORT EventRecord;
  16.  
  17. EXPORT QUALIFIED
  18. DocumentProc,DBoxProc,NoShadowDBox,RDocProc,
  19. altDBoxProc,noGrowDocProc,
  20. WexistsId,
  21. WindowPtr,GrafPtr   ,wDefPtr,wProcPtr,
  22. EventHandler,wDefRec,wProcRec,
  23. allocateWindow,deallocateWindow,
  24. defaultSetup,defaultMethods,
  25. resetfxWindows,PaintScreenGray;
  26.  
  27. CONST (* window definition procedure IDs *)
  28.  DocumentProc = WindowMgr.DocumentProc; (* standard document window *)
  29.  DBoxProc     = WindowMgr.DBoxProc;     (* alertbox or modal dialog box *)
  30.  NoShadowDBox = WindowMgr.NoShadowDBox;
  31.  RDocProc     = WindowMgr.RDocProc;     (* rounded corner window *)
  32.  altDBoxProc = 3; (* dBoxProc with shadow instead of border *)
  33.  noGrowDocProc=4; (* document window without size box *)
  34.  
  35. CONST WexistsId = 0FFFFh; (* special resource ID for allocateWindow *)
  36.                           (* for creating a window task with an already *)
  37.                           (* existing window. e.g. a Dialog-Window *)
  38.  
  39. TYPE WindowPtr = WindowMgr.WindowPtr;
  40.      GrafPtr = QuickDraw.GrafPtr;
  41.      wDefPtr = POINTER TO wDefRec;
  42.      wProcPtr = POINTER TO wProcRec;
  43.      EventHandler = PROCEDURE (VAR EventRecord):BOOLEAN;
  44.  
  45.      wDefRec = RECORD
  46.                 WindowID  : INTEGER; (* resource ID *)
  47.                 wStorage  : ADDRESS; (* Ptr to Window Record *)
  48.                 boundsRect: Rect;    (* for its GrafPort *)
  49.                 title     : StrPtr;  (* a Pascal String *)
  50.                 visible   : BOOLEAN;
  51.                 procID    : INTEGER;
  52.                 behind    : WindowPtr;
  53.                 goAwayFlag: BOOLEAN;
  54.                 refCon    : LongInt; (* user data stored with the window *)
  55.               END;(* wDefRec *)
  56.               (* for window creation: *)
  57.               (* if WindowID = 0 WindowMgr.NewWindow is used together  *)
  58.               (* with the rest of the record. Otherwise it will be     *)
  59.               (* argument to WindowMgr.GetNewWindow for reading in a   *)
  60.               (* Window template with that WindowID from resource file *)
  61.  
  62.  
  63. wProcRec =
  64.       RECORD
  65.        activateProc : EventHandler;
  66.        updateProc   : EventHandler;
  67.        ContentProc  : EventHandler;
  68.        GoAwayProc   : EventHandler;
  69.        GrowProc     : EventHandler;
  70.        CleanupProc  : EventHandler; (* will be called before the Window *)
  71.                                     (* is closed *)
  72.       END; (* of wProcRec *)
  73.       (* Each window in the WindowStack has an associated record of *)
  74.       (* of method procedures. for mouseDown, activateEvt and       *)
  75.       (* updateEvt WindowStack dispatches to one of these methods   *)
  76.       (* depending on the WindowMgr.FindWindow result code.         *)
  77.  
  78. PROCEDURE allocateWindow (VAR theWindow :WindowPtr;
  79.                               theSetup  : wDefPtr;
  80.                               theMethods: wProcPtr);
  81. (* create a new window and process the subsequent events for it. *)
  82. (* theSetup points to a form containing the creation parameters.  *)
  83. (* theMethods points to a collection of procedure variables that *)
  84. (* will be called as associated events occor in the window.      *)
  85. (* theSetup=NIL will create some default window *)
  86. (* for NIL procedure variables default methods will be used *)
  87.  
  88. PROCEDURE deallocateWindow(VAR theWindow:WindowPtr);
  89. (* if theWindow = NIL then return return a pointer to fxWindows *)
  90. (* internal default wDefRec else copy it to the users variable *)
  91. (* stop processing the events for theWindow and dispose its *)
  92. (* WindowRecord *)
  93.  
  94. PROCEDURE defaultSetup  (VAR theSetup  :wDefPtr);
  95. (* if theSetup= NIL then return return a pointer to fxWindows *)
  96. (* internal default wDefRec *)
  97. (* else copy the content of the default wDefRec to theSetup^ *)
  98.  
  99. PROCEDURE defaultMethods(VAR theMethods:wProcPtr);
  100. (*if theMethods is NIL then return a pointer to the internal *)
  101. (* default wProcRec otherwise copy the internal defaults  *)
  102. (* to theMethods^. This allows the user to selectively *)
  103. (* overwrite the defaults *)
  104.  
  105. PROCEDURE resetfxWindows;
  106.  (* dispose all currently active Windows and bring the Module *)
  107.  (* fxWindows into its initial State *)
  108.  
  109. PROCEDURE PaintScreenGray;
  110.  (* fills the portrect of the WindowMgrPort with the gray Pattern *)
  111.  (* of the QuckDraw globals *)
  112.  
  113. END fxWindows.
  114.